<template>
  <svg aria-hidden="true" class="svg-icon">
    <use :xlink:href="symbolId" :fill="color" />
  </svg>
</template>

<script lang="ts" setup>
import { computed } from 'vue'
const props = defineProps({
  // 使用的svg图标名称，也就是svg文件名
  name: {
    type: String,
    required: true,
  },
  color: {
    type: String,
    default: '#333',
  },
})

const symbolId = computed(() => `#icon-${props.name}`)
</script>
<style lang="less" scoped>
.svg-icon {
  width: 14px;
  height: 14px;
  color: currentcolor;
  fill: currentcolor;
}
</style>
